<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<style type="text/css">
	.capt{font:normal 40px 맑은고딕}
	.notice{font:normal 12px 맑은고딕; color:gray}
	.notAdopted{font:normal 12px 맑은고딕; color:darkred}
</style>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.1.0.js"></script>
<script type="text/javascript">
$(function(){
	
	$("#listBtn").click(function(){
		location.href=${initParam.root }+"getContentListPerPage.ju?nowPage="+1;
	});
	$("#findBtn").click(function() {
		location.href=${initParam.root }+"getContentListByTitlePerPage.ju?title="+$("#title").val()+"&nowPage=1";
	});
	$("#writeBtn").click(function() {
		location.href=${initParam.root }+"freeWritePage.ju";
	});
	
});
</script>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="css/board.css">

</head>
<body>

<form name="boardForm" method="post">
<table class="table table-striped table-hover">
<thead>
  <tr>
  <!--  <th class="no">No</th> -->
   <th align="center" class="title">제목</th>
  <th align="center" class="name">작성자</th>
   <th align="center" class="date">작성일</th>
   <th align="center" class="hit">조회수</th>
   </tr>
 </thead>
 <tbody>

<c:forEach items="${requestScope.bvo.list}" var="list">
<tr><!-- 제목을 누르면 조회수 증가 번호에 해당하는 상세페이지로 이동 -->
<c:choose>
<c:when test="${list.kind =='공지사항' }">
<td align="center"><b><a href="getFreeDetailIncHit.ju?no=${list.no }">${list.title }</a></b></td>
</c:when>
<c:otherwise>
<td align="center"><a href="getFreeDetailIncHit.ju?no=${list.no }">${list.title }</a></td>
</c:otherwise>
</c:choose>
<td align="center">${list.memberVO.nickname }</td><td align="center">${list.date }</td><td>${list.hit }</td>
</tr>

</c:forEach>
</tbody>

<tfoot>
<tr><td colspan="4" align="right">
<c:if test="${sessionScope.mvo != null}">
<!-- <input type="button" id="writeBtn" value="글쓰기"> -->
<img src="${initParam.root }img/writeBtn.png" height="25px"  id="writeBtn" >
</c:if>
</td></tr>
<tr>
<td align="center">
<!-- 현재그룹의 시작페이지번호-페이지 그룹당 페이지 수 하여 이동 -->
<c:choose>
<c:when test="${requestScope.bvo.pagingBean.previousPageGroup}">
<a href="getContentListByTitlePerPage.ju?title=${requestScope.bvo.pagingBean.title}&nowPage=${requestScope.bvo.pagingBean.startPageOfPageGroup - requestScope.bvo.pagingBean.numberOfPageGroup}">◀</a><!-- 미완성 -->
</c:when>
</c:choose>
</td>
<td align="center">
<!-- 현재 그룹의 페이지번호 출력 및 게시물보기 링크 -->
<c:forEach var= "i" 
begin="${requestScope.bvo.pagingBean.startPageOfPageGroup}" end="${requestScope.bvo.pagingBean.endPageOfPageGroup}">
<a href="getContentListByTitlePerPage.ju?title=${requestScope.bvo.pagingBean.title}&nowPage=${i}">${i}</a>
</c:forEach>
</td>

<td align="center">
<!-- 현재그룹의 마지막페이지번호 +1로 이동 -->
<c:choose>
<c:when test="${requestScope.bvo.pagingBean.nextPageGroup == 'true'}">
<a href="getContentListByTitlePerPage.ju?title=${requestScope.bvo.pagingBean.title}&nowPage=${requestScope.bvo.pagingBean.endPageOfPageGroup +1}">▶</a>
</c:when>
</c:choose>
</td>
</tr>
<tr>
<td align="center" colspan="5">제목 검색 <input type="text" id="title" name="title">
<input type="image" id="findBtn" src="${initParam.root }img/searchBtn.png" autocomplete="on"  height="25px">
<!-- <input type="button" id="findBtn" value="검색"> -->
</td>
</tr>
</tfoot>

</table>

</form>

</body>
</html>